<template>
	<view class="pages u-flex-column">
		<view class="img_tab u-flex-between u-flex">
			<!-- <view class="menber_item" v-for="(item,index) in menber_list" :key="index" @click="current=index">
				<image :src="`${$http_cos}${item.name}`"></image>
			</view> -->
			<swiper class="swiper"  :display-multiple-items="4" :duration="duration"  :current="current"
			next-margin="-10px" :circular="circular" :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval"
				@change="swipeIndex">
				<swiper-item v-for="(item,index) in menber_list" :key="index" style="margin-right: 20rpx !important" @click="current_change(item,index)">
					<view  class="menber_item" style="margin-right:10px;" :data-index="index">
						<image :src="`${$http_cos}${item.name}`" ></image>
					</view>
				</swiper-item>	
			</swiper>
		</view>
		<!-- list[current].line_left -->
		<scroll-view scroll-y class="u-flex-1 info-panel-content">
			<view class="info-panel-triple" v-if="list.length>0" :style="{transform:'translate('+list[current].line_left+'px'+')'}"></view>
			<swiper class="swiper" @change="swipeIndex"
							:duration="duration" :current="current" :circular="circular">
							<swiper-item v-for="(item,index) in menber_list" :key="index">
								<image :src="`${$http_cos}${item.url}`" mode="widthFix"  :data-index="index"></image>
							</swiper-item>
			</swiper>
			
			
		</scroll-view>
	</view>
</template>

<script>
	import {menber_list} from '@/util/grade_member.js'
	export default {
		data() {
			return {
				circular:true,
				indicatorDots:false,
				autoplay:false,
				interval: 2000,
				duration: 500,
				current1:0,
				list:[],
				current:0,
				menber_list:menber_list,
				
			}
		},
		onLoad(option) {
			if(option.current){
				setTimeout(()=>{
				this.current=option.current	
				},1000)
			}
		},
		onReady() {
			
				this.changeDemo()
		},
		methods: {
			current_change(item,index){
				this.current=index
			},
			changeDemo(){
				const query = uni.createSelectorQuery().in(this);
					query.selectAll('.menber_item').boundingClientRect(data => {
						data.map(item=>{
							item.line_left=(data[0].width/2)+data[0].left-6
							return item
						})
						this.list=data
					}).exec();
			},
			swipeIndex(e){
				this.current = e.detail.current
			}
		}
	}
</script>

<style lang="scss">
	.pages {
		height: 100vh;
		/deep/.uni-scroll-view{
			overflow:visible !important;
		}
		/deep/ uni-swiper{
			height:100%;
		}
		 
	}

	.img_tab {
		height: 328rpx;
		background: #333333;
		opacity: 0.9;
		padding: 40rpx 40rpx 0;
		box-sizing: border-box;
		.swiper {
			height: 200rpx;
			width: 100%;
			overflow: hidden;
			
			swiper-item {
				width: 100%;
				height:100%;
				box-sizing: border-box;
					
			}
			
		}
		.menber_img {
			width: 152rpx;
			height: 200rpx;
			display: inline-block;
			image{
				width:100%;
				height:100%;
				display: block;
			}
		}
		.menber_item {
			width: 152rpx;
			height: 200rpx;
		}
	}

	.info-type-one {
		width: 120px;
		height: 30px;
		border: 1px solid #EEE;
		margin: 0 auto;
		text-align: center;
		line-height: 30px;
	}

	// hsla(0,0%,6%,.6)
	.info-panel-triple {
		width: 0;
		height: 0;
		border: 16rpx solid transparent;
		border-bottom-color: #FFF;
		position: absolute;
		top: -30rpx;
		transition-duration: 300ms;
		transition-property: transform, -webkit-transform;
		animation:5s infinite;
	}

	.info-panel-content {
		display: inline-block;
		position: relative;
		border-radius: 20rpx;
		margin-top: -28rpx;
		line-height: 30px;
		background-color: #FFF;
		color: #FFF;
		text-align: left;
		font-size: 0.8rem;
		box-sizing: border-box;
		image{
			margin-top: 36rpx;
		}
	}
</style>
